Moving from a Windows to a Linux App Service in Azure

I’ve recently migrated some projects from older versions of .Net (4.7 and .Net Core 2.x) to .Net 5. This have given me the option to host these projects on a Linux App Service. One of the main reasons to move to a Linux based App Service is the savings in hosting costs, but it has also thrown up some gotchas that I want you to be aware of.

Gotchas

Before migrating your web app from a Windows App Service to a Linux App Service there are some things you should be aware of:

  • Check that the components your app is using have a .Net Core / .Net 5 version that can run on Linux. This has held up one of my application migrations whilst I source a key component that has a .Net 5 compatible version.

  • Application Insights can’t be added through portal. You will need to add a code-based implementation - https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core

  • Linux App Service don’t currently support Web Jobs. If you need to run background tasks you will need to find another way of running them.

  • There are some other Azure Portal features that don’t work on Linux App Services, including the Process Explorer, Extensions and Clone App.

  • Pathing - if you need to reference any system file paths make sure you use System.IO.Path.Combine. This will avoid any confusion between forward and back slashes in your pathing.

Domain Names and SLL Migration

One of the aspects I was most concerned about was moving the domain names and SSL certificates for these App Service from Windows to Linux. I found little documentation on the process, and I think the reason for this, is that it turned out to be very straight forward and painless.

A couple of points. My domain name is managed by a third party, but the SSL is managed through Azure. I have found managing the SSL through Azure takes all the pain out of setting up and renewing SSL certificates.

When it came to configuring the new Linux App Service, both the domain name and the SLL setup was very easy. Normally when you setup a new domain name in Azure you have to prove the ownership of the domain. But as this was already done when I setup the old Windows App Service, Azure already had a record of this and I could select my domain name straight away. I didn’t have to go through the verification steps again.

The SSL was equally as straight forward. I just had to pick the SSL that I had previously purchased for my old App Service from a list.

Once I had configured the domain name and SSL I just had to update my domain’s CNAME record and wait for the DNS to propagate.

Alex Orpwood Written by:

Software developing and architecting for 20 years. Satellite monitoring by day, writing my own app by night. More about me